{% extends 'core/base.html' %}

{% block title %}
  Inbox
{% endblock %}

{% block content %}
  <div>
    <div class="w-1/2 my-6 mx-auto p-3 bg-gray-100 border border-gray-300 rounded-xl">
      <h1 class="text-center text-2xl">Inbox</h1>
    </div>
    <div class="space-y-6">
      {% for chat in chats %}
        <div class="w-1/2 my-6 mx-auto p-3 bg-gray-100 border border-gray-300 rounded-xl">
          {# prettier-ignore #}
          <a href="{% url 'chat:detail'  chat.id  %}">
        <div class="p-6 flex bg-gray-100 rounded-xl">
          <div>
            {% for user in chat.users.all %}
              {% if user != request.user %}
                <p class="mb-4">
                  <strong>{{ user.username }}</strong> | {{ chat.modified_at }}
                </p>
                <p>{{ chat.mesege }}</p>
              {% endif %}
            {% endfor %}
          </div>
        </div>
      </a>
        </div>
      {% endfor %}
    </div>
  </div>
{% endblock %}
